﻿using FirstHomeWork.Interface;
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Configuration;
using FirstHomeWork.Utility;

namespace FirstHomeWork.SqlHelperFactory
{
    public class SimpleFactory
    {
        private static string IDBHelperConfig = CustomConfig.GetConfig("IDBHelperConfig");
        private static string DllName = IDBHelperConfig.Split(',')[1];
        private static string TypeName = IDBHelperConfig.Split(',')[0];

        public static IDBHelper CreateDBHelper()
        {
            Assembly assembly = Assembly.LoadFrom(DllName);
            Type type = assembly.GetType(TypeName);
            return Activator.CreateInstance(type) as IDBHelper;
        }

    }
}
